package com.uzai.console.web.pyq;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.pyq.hdkgoods.PyqHdkGoodsJobBatchSendDao;
import com.uzai.console.dto.pyq.hdkgoods.PyqHdkGoodsJobSendDao;
import com.uzai.console.dto.pyq.hdkgoods.PyqHdkGoodsQuery;
import com.uzai.console.dto.pyq.pyqgoods.PyqJobBatchSendDao;
import com.uzai.console.dto.pyq.pyqgoods.PyqJobSendDao;
import com.uzai.console.dto.pyq.pyqgoods.PyqTbGoodsQuery;
import com.uzai.console.service.hdk.HdkGoodsService;
import com.uzai.console.service.pyq.PyqGoodsService;
import com.uzai.console.service.pyq.PyqHdkGoodsService;
import com.uzai.console.service.qiniu.QiniuService;
import com.uzai.console.vo.base.SelectIdVo;
import com.uzai.console.vo.pyq.hdkgoods.PyqHdkGoodsVo;
import com.uzai.console.vo.pyq.pyqgoods.PyqTbGoodsResultVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 朋友圈好单库商品列表
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "好单库商品列表",tags = "个人微信|朋友圈|好单库商品列表")
@ApiSort(31)
@RestController
public class PyqHdkGoodsController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(PyqHdkGoodsController.class);

    @Autowired
    private PyqHdkGoodsService pyqHdkGoodsService;
    @Autowired
    private HdkGoodsService hdkGoodsService;

    @ApiOperation(value = "分页查询好单库商品列表", notes = "分页查询好单库商品列表", response = PyqHdkGoodsVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/pyqHdkGoods/findPyqHdkGoodsList")
    public Object findPyqHdkGoodsList(@RequestBody PyqHdkGoodsQuery pyqHdkGoodsQuery){
        pyqHdkGoodsQuery.setSize(40);//默认查询40条
        pyqHdkGoodsQuery.setAsc(false);
        pyqHdkGoodsQuery.setOrderByField("showTime");
        return pyqHdkGoodsService.findPyqHdkGoodsList(pyqHdkGoodsQuery);
    }

    @ApiOperation(value = "批量商品发送朋友圈任务", notes = "批量商品发送朋友圈任务")
    @ApiOperationSupport(order = 2)
    @PostMapping("/pyqHdkGoods/batchSendPyqJpb")
    public Object batchSendPyqJpb(@RequestBody PyqHdkGoodsJobBatchSendDao pyqHdkGoodsJobBatchSendDao){
         pyqHdkGoodsService.batchSendPyqJpb(pyqHdkGoodsJobBatchSendDao);
        return true;
    }

    @ApiOperation(value = "单个商品发送朋友圈任务", notes = "单个商品发送朋友圈任务")
    @ApiOperationSupport(order = 3)
    @PostMapping("/pyqHdkGoods/sendPyqJpb")
    public Object sendPyqJpb(@RequestBody PyqHdkGoodsJobSendDao pyqHdkGoodsJobSendDao){
        pyqHdkGoodsService.sendPyqJpb(pyqHdkGoodsJobSendDao);
        return true;
    }

    @ApiOperation(value = "更新好单库最新商品", notes = "更新好单库最新商品")
    @ApiOperationSupport(order = 4)
    @PostMapping("/pyqHdkGoods/downLoadHdkGoodsSync")
    public Object downLoadHdkGoodsSync(){
        hdkGoodsService.downLoadHdkGoodsSync();
        return true;
    }

}
